import com.lijinjiang.beautyeye.BeautyEyeLNFHelper;

import javax.swing.*;
import java.awt.*;

/**
 * @ClassName Demo01
 * @Description TODO
 * @Author Li
 * @Date 2022/9/13 16:26
 * @ModifyDate 2022/9/13 16:26
 * @Version 1.0
 */
public class Demo01 {
    private static JPanel createPanel(Color bg, int x, int y, int width, int height) {
        JPanel panel = new JPanel(); // 创建一个JPanel
        panel.setOpaque(true); // 设置不透明
        panel.setBackground(bg); // 设置背景颜色
        panel.setBounds(x, y, width, height); // 设置面板的位置和宽高
        return panel;
    }

    public static void main(String[] args) {
        try {
            BeautyEyeLNFHelper.frameBorderStyle = BeautyEyeLNFHelper.FrameBorderStyle.generalNoTranslucencyShadow;
            BeautyEyeLNFHelper.launchBeautyEyeLNF();
        } catch (Exception e) {
            e.printStackTrace();
        }
        JFrame frame = new JFrame();
        frame.setTitle("Demo01"); // 设置窗口标题
        frame.setSize(400, 300); // 设置窗口显示大小

        JLayeredPane layeredPane = new JLayeredPane(); // 创建层级面板

        JPanel panel01 = createPanel(Color.RED, 90, 30, 100, 100);
        layeredPane.add(panel01, new Integer(100));
        JPanel panel02 = createPanel(Color.YELLOW, 150, 50, 100, 100);
        layeredPane.add(panel02, new Integer(100), 0);
        JPanel panel03 = createPanel(Color.BLUE, 120, 90, 100, 100);
        layeredPane.add(panel03, new Integer(100), 1);
        JPanel panel04 = createPanel(Color.GREEN, 170, 110, 100, 100);
        layeredPane.add(panel04, new Integer(200));

        frame.add(layeredPane);

        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // 设置窗口默认关闭操作
        frame.setLocationRelativeTo(null); // 相对屏幕居中
        frame.setVisible(true); // 设置窗口可见
    }
}
